<?php
require_once dirname(__FILE__).'/Item.php';

class NewsReply{
	
	public $_toUserName;
	public $_fromUserName;
	private $_createTime;
	private $_msgType;
	public $_content;
	public $_articleCount;
	private $_funcFlag;
	public $_article = array();
	
	
	function toXmlString(){
		$this->_createTime = time();
		$this->_msgType = "news";
		$this->_funcFlag = "1";
		
		$art_size = count($this->_article);
		$this->_articleCount = $art_size;
		
		$xmlString = '<xml>';
		$xmlString = $xmlString.'<ToUserName>'.$this->_toUserName.'</ToUserName>';
		$xmlString = $xmlString.'<FromUserName>'.$this->_fromUserName.'</FromUserName>';
		$xmlString = $xmlString.'<CreateTime>'.$this->_createTime.'</CreateTime>';
		$xmlString = $xmlString.'<MsgType>'.$this->_msgType.'</MsgType>';
		$xmlString = $xmlString.'<Content>'.$this->_content.'</Content>';
		$xmlString = $xmlString.'<ArticleCount>'.$this->_articleCount.'</ArticleCount>';
		$xmlString = $xmlString.'<Articles>';
		
		
		//for($i=0; $i<$this->_articleCount; $i++){
		for($i=0; $i<$art_size; $i++){
			$xmlString = $xmlString.'<item>';
			$item = $this->_article[$i];
			$xmlString = $xmlString.'<Title><![CDATA['.$item->_title.']]></Title>';
			$xmlString = $xmlString.'<Description><![CDATA['.$item->_title.$item->_description.']]></Description>';
			$xmlString = $xmlString.'<PicUrl>'.$item->_picUrl.'</PicUrl>';
			$xmlString = $xmlString.'<Url>'.$item->_url.'</Url>';
			$xmlString = $xmlString.'</item>';
		}
		$xmlString = $xmlString.'</Articles>';
		$xmlString = $xmlString.'<FuncFlag>'.$this->_funcFlag.'</FuncFlag>';
		
		$xmlString = $xmlString.'</xml>';
		return $xmlString;
	}
}
?>